﻿using System; 
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic; 
using System.Data;
using DBUtility;

namespace XQ.SP.DalServices  
{
	 	//产品详细复制国美
		public partial class ShopProduceCopyGuoDal : BaseDal
	{
   		     
		public bool ExistsWhere(string whereSql)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from ShopProduceCopyGuo");
            if (whereSql != "")
            {
                strSql.Append(" where " + whereSql);
            }
			
			return DbHelperSQL.Exists(strSql.ToString());
		}
		public bool Exists(long id)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from [ShopProduceCopyGuo]");
			strSql.Append(" where  [Id]=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = id;
			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}
		
				
		
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public long Add(XQ.SP.Model.ShopProduceCopyGuoItem model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into [ShopProduceCopyGuo](");			
            strSql.Append("[ProduceNO],[ShopProduceName],[PriceWai],[PriceNei],[PriceMin],[NumberMin],[SellsNumber],[Unit],[ShopUsersName],[Transactions],[Address],[Contact],[Description],[ShopBrandId],[ShopTypeID],[StoreBaseID],[StoreBaseName],[InsertDateTime],[UpdateDateTime],[StartDateTime],[LimitDays],[UserID],[UserName],[ImagesPhoto],[ImagesSP],[IsHave],[ClickCount],[State],[Status],[Creator],[Created],[Modifier],[Modified],[ImagesSPAttr]");
			strSql.Append(") values (");
            strSql.Append("@ProduceNO,@ShopProduceName,@PriceWai,@PriceNei,@PriceMin,@NumberMin,@SellsNumber,@Unit,@ShopUsersName,@Transactions,@Address,@Contact,@Description,@ShopBrandId,@ShopTypeID,@StoreBaseID,@StoreBaseName,@InsertDateTime,@UpdateDateTime,@StartDateTime,@LimitDays,@UserID,@UserName,@ImagesPhoto,@ImagesSP,@IsHave,@ClickCount,@State,@Status,@Creator,@Created,@Modifier,@Modified,@ImagesSPAttr");            
            strSql.Append(") ");            
            strSql.Append(";select @@IDENTITY");		
			SqlParameter[] parameters = {
			            new SqlParameter("@ProduceNO", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@ShopProduceName", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@PriceWai", SqlDbType.Decimal,9) ,            
                        new SqlParameter("@PriceNei", SqlDbType.Decimal,9) ,            
                        new SqlParameter("@PriceMin", SqlDbType.Decimal,9) ,            
                        new SqlParameter("@NumberMin", SqlDbType.Int,4) ,            
                        new SqlParameter("@SellsNumber", SqlDbType.Int,4) ,            
                        new SqlParameter("@Unit", SqlDbType.NVarChar,10) ,            
                        new SqlParameter("@ShopUsersName", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@Transactions", SqlDbType.Int,4) ,            
                        new SqlParameter("@Address", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@Contact", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@Description", SqlDbType.NVarChar,4000) ,            
                        new SqlParameter("@ShopBrandId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@ShopTypeID", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@StoreBaseID", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@StoreBaseName", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@InsertDateTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@UpdateDateTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@StartDateTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@LimitDays", SqlDbType.Int,4) ,            
                        new SqlParameter("@UserID", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@UserName", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@ImagesPhoto", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@ImagesSP", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@IsHave", SqlDbType.Int,4) ,            
                        new SqlParameter("@ClickCount", SqlDbType.Int,4) ,            
                        new SqlParameter("@State", SqlDbType.Int,4) ,            
                        new SqlParameter("@Status", SqlDbType.Int,4) ,            
                        new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Created", SqlDbType.DateTime) ,            
                        new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Modified", SqlDbType.DateTime) ,            
                        new SqlParameter("@ImagesSPAttr", SqlDbType.NVarChar,1000)             
              
            };
			            
            parameters[0].Value = model.ProduceNO;                        
            parameters[1].Value = model.ShopProduceName;                        
            parameters[2].Value = model.PriceWai;                        
            parameters[3].Value = model.PriceNei;                        
            parameters[4].Value = model.PriceMin;                        
            parameters[5].Value = model.NumberMin;                        
            parameters[6].Value = model.SellsNumber;                        
            parameters[7].Value = model.Unit;                        
            parameters[8].Value = model.ShopUsersName;                        
            parameters[9].Value = model.Transactions;                        
            parameters[10].Value = model.Address;                        
            parameters[11].Value = model.Contact;                        
            parameters[12].Value = model.Description;                        
            parameters[13].Value = model.ShopBrandId;                        
            parameters[14].Value = model.ShopTypeID;                        
            parameters[15].Value = model.StoreBaseID;                        
            parameters[16].Value = model.StoreBaseName;                        
            parameters[17].Value = model.InsertDateTime;                        
            parameters[18].Value = model.UpdateDateTime;                        
            parameters[19].Value = model.StartDateTime;                        
            parameters[20].Value = model.LimitDays;                        
            parameters[21].Value = model.UserID;                        
            parameters[22].Value = model.UserName;                        
            parameters[23].Value = model.ImagesPhoto;                        
            parameters[24].Value = model.ImagesSP;                        
            parameters[25].Value = model.IsHave;                        
            parameters[26].Value = model.ClickCount;                        
            parameters[27].Value = model.State;                        
            parameters[28].Value = model.Status;                        
            parameters[29].Value = model.Creator;                        
            parameters[30].Value = model.Created;                        
            parameters[31].Value = model.Modifier;                        
            parameters[32].Value = model.Modified;                        
            parameters[33].Value = model.ImagesSPAttr;                        
			   
			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
				                                    
            	return Convert.ToInt64(obj);
                                                  
			}			   
            			
		}
		
		/// <summary>
		///   批量添加数据
		/// </summary>
		public int AddList(List<XQ.SP.Model.ShopProduceCopyGuoItem> models)
		{
			List<CommandInfo> commands = new List<CommandInfo>();
			foreach(XQ.SP.Model.ShopProduceCopyGuoItem item in models)
			{
				CommandInfo command = new CommandInfo();
				StringBuilder strSql=new StringBuilder();
				strSql.Append("insert into [ShopProduceCopyGuo](");			
	            strSql.Append("[ProduceNO],[ShopProduceName],[PriceWai],[PriceNei],[PriceMin],[NumberMin],[SellsNumber],[Unit],[ShopUsersName],[Transactions],[Address],[Contact],[Description],[ShopBrandId],[ShopTypeID],[StoreBaseID],[StoreBaseName],[InsertDateTime],[UpdateDateTime],[StartDateTime],[LimitDays],[UserID],[UserName],[ImagesPhoto],[ImagesSP],[IsHave],[ClickCount],[State],[Status],[Creator],[Created],[Modifier],[Modified],[ImagesSPAttr]");
				strSql.Append(") values (");
	            strSql.Append("@ProduceNO,@ShopProduceName,@PriceWai,@PriceNei,@PriceMin,@NumberMin,@SellsNumber,@Unit,@ShopUsersName,@Transactions,@Address,@Contact,@Description,@ShopBrandId,@ShopTypeID,@StoreBaseID,@StoreBaseName,@InsertDateTime,@UpdateDateTime,@StartDateTime,@LimitDays,@UserID,@UserName,@ImagesPhoto,@ImagesSP,@IsHave,@ClickCount,@State,@Status,@Creator,@Created,@Modifier,@Modified,@ImagesSPAttr");            
	            strSql.Append(") ");            
	            strSql.Append(";select @@IDENTITY");		
				SqlParameter[] parameters = {
					            new SqlParameter("@ProduceNO", SqlDbType.NVarChar,40) ,            
	            	            new SqlParameter("@ShopProduceName", SqlDbType.NVarChar,100) ,            
	            	            new SqlParameter("@PriceWai", SqlDbType.Decimal,9) ,            
	            	            new SqlParameter("@PriceNei", SqlDbType.Decimal,9) ,            
	            	            new SqlParameter("@PriceMin", SqlDbType.Decimal,9) ,            
	            	            new SqlParameter("@NumberMin", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@SellsNumber", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Unit", SqlDbType.NVarChar,10) ,            
	            	            new SqlParameter("@ShopUsersName", SqlDbType.NVarChar,40) ,            
	            	            new SqlParameter("@Transactions", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Address", SqlDbType.NVarChar,100) ,            
	            	            new SqlParameter("@Contact", SqlDbType.NVarChar,40) ,            
	            	            new SqlParameter("@Description", SqlDbType.NVarChar,4000) ,            
	            	            new SqlParameter("@ShopBrandId", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@ShopTypeID", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@StoreBaseID", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@StoreBaseName", SqlDbType.NVarChar,40) ,            
	            	            new SqlParameter("@InsertDateTime", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@UpdateDateTime", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@StartDateTime", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@LimitDays", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@UserID", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@UserName", SqlDbType.NVarChar,40) ,            
	            	            new SqlParameter("@ImagesPhoto", SqlDbType.NVarChar,1000) ,            
	            	            new SqlParameter("@ImagesSP", SqlDbType.NVarChar,1000) ,            
	            	            new SqlParameter("@IsHave", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@ClickCount", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@State", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Status", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@Created", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@Modified", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@ImagesSPAttr", SqlDbType.NVarChar,1000)             
	              
	            };
	            				            
	            parameters[0].Value = item.ProduceNO;	                        
	            parameters[1].Value = item.ShopProduceName;	                        
	            parameters[2].Value = item.PriceWai;	                        
	            parameters[3].Value = item.PriceNei;	                        
	            parameters[4].Value = item.PriceMin;	                        
	            parameters[5].Value = item.NumberMin;	                        
	            parameters[6].Value = item.SellsNumber;	                        
	            parameters[7].Value = item.Unit;	                        
	            parameters[8].Value = item.ShopUsersName;	                        
	            parameters[9].Value = item.Transactions;	                        
	            parameters[10].Value = item.Address;	                        
	            parameters[11].Value = item.Contact;	                        
	            parameters[12].Value = item.Description;	                        
	            parameters[13].Value = item.ShopBrandId;	                        
	            parameters[14].Value = item.ShopTypeID;	                        
	            parameters[15].Value = item.StoreBaseID;	                        
	            parameters[16].Value = item.StoreBaseName;	                        
	            parameters[17].Value = item.InsertDateTime;	                        
	            parameters[18].Value = item.UpdateDateTime;	                        
	            parameters[19].Value = item.StartDateTime;	                        
	            parameters[20].Value = item.LimitDays;	                        
	            parameters[21].Value = item.UserID;	                        
	            parameters[22].Value = item.UserName;	                        
	            parameters[23].Value = item.ImagesPhoto;	                        
	            parameters[24].Value = item.ImagesSP;	                        
	            parameters[25].Value = item.IsHave;	                        
	            parameters[26].Value = item.ClickCount;	                        
	            parameters[27].Value = item.State;	                        
	            parameters[28].Value = item.Status;	                        
	            parameters[29].Value = item.Creator;	                        
	            parameters[30].Value = item.Created;	                        
	            parameters[31].Value = item.Modifier;	                        
	            parameters[32].Value = item.Modified;	                        
	            parameters[33].Value = item.ImagesSPAttr;	            	            
	         	command.CommandText = strSql.ToString();
	         	command.Parameters = parameters;
	         	
	         	commands.Add(command);
	         }
            
			object obj = DbHelperSQL.ExecuteSqlTran(commands);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
            	return Convert.ToInt32(obj);
			}
			
           
		}
		
		
		/// <summary>
		/// 批量更新数据
		/// </summary>
		public int UpdateList(List<XQ.SP.Model.ShopProduceCopyGuoItem> models)
		{
			List<CommandInfo> commands = new List<CommandInfo>();
			CommandInfo command = new CommandInfo();
			
			foreach(XQ.SP.Model.ShopProduceCopyGuoItem item in models)
			{
					StringBuilder strSql=new StringBuilder();
					strSql.Append("update [ShopProduceCopyGuo] set ");
							            		            		                        
		            strSql.Append(" [ProduceNO] = @ProduceNO , ");		            		                        
		            strSql.Append(" [ShopProduceName] = @ShopProduceName , ");		            		                        
		            strSql.Append(" [PriceWai] = @PriceWai , ");		            		                        
		            strSql.Append(" [PriceNei] = @PriceNei , ");		            		                        
		            strSql.Append(" [PriceMin] = @PriceMin , ");		            		                        
		            strSql.Append(" [NumberMin] = @NumberMin , ");		            		                        
		            strSql.Append(" [SellsNumber] = @SellsNumber , ");		            		                        
		            strSql.Append(" [Unit] = @Unit , ");		            		                        
		            strSql.Append(" [ShopUsersName] = @ShopUsersName , ");		            		                        
		            strSql.Append(" [Transactions] = @Transactions , ");		            		                        
		            strSql.Append(" [Address] = @Address , ");		            		                        
		            strSql.Append(" [Contact] = @Contact , ");		            		                        
		            strSql.Append(" [Description] = @Description , ");		            		                        
		            strSql.Append(" [ShopBrandId] = @ShopBrandId , ");		            		                        
		            strSql.Append(" [ShopTypeID] = @ShopTypeID , ");		            		                        
		            strSql.Append(" [StoreBaseID] = @StoreBaseID , ");		            		                        
		            strSql.Append(" [StoreBaseName] = @StoreBaseName , ");		            		                        
		            strSql.Append(" [InsertDateTime] = @InsertDateTime , ");		            		                        
		            strSql.Append(" [UpdateDateTime] = @UpdateDateTime , ");		            		                        
		            strSql.Append(" [StartDateTime] = @StartDateTime , ");		            		                        
		            strSql.Append(" [LimitDays] = @LimitDays , ");		            		                        
		            strSql.Append(" [UserID] = @UserID , ");		            		                        
		            strSql.Append(" [UserName] = @UserName , ");		            		                        
		            strSql.Append(" [ImagesPhoto] = @ImagesPhoto , ");		            		                        
		            strSql.Append(" [ImagesSP] = @ImagesSP , ");		            		                        
		            strSql.Append(" [IsHave] = @IsHave , ");		            		                        
		            strSql.Append(" [ClickCount] = @ClickCount , ");		            		                        
		            strSql.Append(" [State] = @State , ");		            		                        
		            strSql.Append(" [Status] = @Status , ");		            		                        
		            strSql.Append(" [Creator] = @Creator , ");		            		                        
		            strSql.Append(" [Created] = @Created , ");		            		                        
		            strSql.Append(" [Modifier] = @Modifier , ");		            		                        
		            strSql.Append(" [Modified] = @Modified , ");		            		                        
		            strSql.Append(" [ImagesSPAttr] = @ImagesSPAttr  ");		            			
					strSql.Append(" where [Id]=@Id ");
								
					SqlParameter[] parameters = {
							            new SqlParameter("@Id", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@ProduceNO", SqlDbType.NVarChar,40) ,		            
		            		            new SqlParameter("@ShopProduceName", SqlDbType.NVarChar,100) ,		            
		            		            new SqlParameter("@PriceWai", SqlDbType.Decimal,9) ,		            
		            		            new SqlParameter("@PriceNei", SqlDbType.Decimal,9) ,		            
		            		            new SqlParameter("@PriceMin", SqlDbType.Decimal,9) ,		            
		            		            new SqlParameter("@NumberMin", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@SellsNumber", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Unit", SqlDbType.NVarChar,10) ,		            
		            		            new SqlParameter("@ShopUsersName", SqlDbType.NVarChar,40) ,		            
		            		            new SqlParameter("@Transactions", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Address", SqlDbType.NVarChar,100) ,		            
		            		            new SqlParameter("@Contact", SqlDbType.NVarChar,40) ,		            
		            		            new SqlParameter("@Description", SqlDbType.NVarChar,4000) ,		            
		            		            new SqlParameter("@ShopBrandId", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@ShopTypeID", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@StoreBaseID", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@StoreBaseName", SqlDbType.NVarChar,40) ,		            
		            		            new SqlParameter("@InsertDateTime", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@UpdateDateTime", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@StartDateTime", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@LimitDays", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@UserID", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@UserName", SqlDbType.NVarChar,40) ,		            
		            		            new SqlParameter("@ImagesPhoto", SqlDbType.NVarChar,1000) ,		            
		            		            new SqlParameter("@ImagesSP", SqlDbType.NVarChar,1000) ,		            
		            		            new SqlParameter("@IsHave", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@ClickCount", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@State", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Status", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Creator", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Created", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Modified", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@ImagesSPAttr", SqlDbType.NVarChar,1000) 		            
		              
		            };
		            					            
		            parameters[0].Value = item.Id;		                        
		            parameters[1].Value = item.ProduceNO;		                        
		            parameters[2].Value = item.ShopProduceName;		                        
		            parameters[3].Value = item.PriceWai;		                        
		            parameters[4].Value = item.PriceNei;		                        
		            parameters[5].Value = item.PriceMin;		                        
		            parameters[6].Value = item.NumberMin;		                        
		            parameters[7].Value = item.SellsNumber;		                        
		            parameters[8].Value = item.Unit;		                        
		            parameters[9].Value = item.ShopUsersName;		                        
		            parameters[10].Value = item.Transactions;		                        
		            parameters[11].Value = item.Address;		                        
		            parameters[12].Value = item.Contact;		                        
		            parameters[13].Value = item.Description;		                        
		            parameters[14].Value = item.ShopBrandId;		                        
		            parameters[15].Value = item.ShopTypeID;		                        
		            parameters[16].Value = item.StoreBaseID;		                        
		            parameters[17].Value = item.StoreBaseName;		                        
		            parameters[18].Value = item.InsertDateTime;		                        
		            parameters[19].Value = item.UpdateDateTime;		                        
		            parameters[20].Value = item.StartDateTime;		                        
		            parameters[21].Value = item.LimitDays;		                        
		            parameters[22].Value = item.UserID;		                        
		            parameters[23].Value = item.UserName;		                        
		            parameters[24].Value = item.ImagesPhoto;		                        
		            parameters[25].Value = item.ImagesSP;		                        
		            parameters[26].Value = item.IsHave;		                        
		            parameters[27].Value = item.ClickCount;		                        
		            parameters[28].Value = item.State;		                        
		            parameters[29].Value = item.Status;		                        
		            parameters[30].Value = item.Creator;		                        
		            parameters[31].Value = item.Created;		                        
		            parameters[32].Value = item.Modifier;		                        
		            parameters[33].Value = item.Modified;		                        
		            parameters[34].Value = item.ImagesSPAttr;		            		            
	            command.CommandText = strSql.ToString();
	         	command.Parameters = parameters;
	         	commands.Add(command);
	         }
            
            int rows=DbHelperSQL.ExecuteSqlTran(commands);
			return rows;

		}
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(XQ.SP.Model.ShopProduceCopyGuoItem model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update [ShopProduceCopyGuo] set ");
			                                                
            strSql.Append(" [ProduceNO] = @ProduceNO , ");                                    
            strSql.Append(" [ShopProduceName] = @ShopProduceName , ");                                    
            strSql.Append(" [PriceWai] = @PriceWai , ");                                    
            strSql.Append(" [PriceNei] = @PriceNei , ");                                    
            strSql.Append(" [PriceMin] = @PriceMin , ");                                    
            strSql.Append(" [NumberMin] = @NumberMin , ");                                    
            strSql.Append(" [SellsNumber] = @SellsNumber , ");                                    
            strSql.Append(" [Unit] = @Unit , ");                                    
            strSql.Append(" [ShopUsersName] = @ShopUsersName , ");                                    
            strSql.Append(" [Transactions] = @Transactions , ");                                    
            strSql.Append(" [Address] = @Address , ");                                    
            strSql.Append(" [Contact] = @Contact , ");                                    
            strSql.Append(" [Description] = @Description , ");                                    
            strSql.Append(" [ShopBrandId] = @ShopBrandId , ");                                    
            strSql.Append(" [ShopTypeID] = @ShopTypeID , ");                                    
            strSql.Append(" [StoreBaseID] = @StoreBaseID , ");                                    
            strSql.Append(" [StoreBaseName] = @StoreBaseName , ");                                    
            strSql.Append(" [InsertDateTime] = @InsertDateTime , ");                                    
            strSql.Append(" [UpdateDateTime] = @UpdateDateTime , ");                                    
            strSql.Append(" [StartDateTime] = @StartDateTime , ");                                    
            strSql.Append(" [LimitDays] = @LimitDays , ");                                    
            strSql.Append(" [UserID] = @UserID , ");                                    
            strSql.Append(" [UserName] = @UserName , ");                                    
            strSql.Append(" [ImagesPhoto] = @ImagesPhoto , ");                                    
            strSql.Append(" [ImagesSP] = @ImagesSP , ");                                    
            strSql.Append(" [IsHave] = @IsHave , ");                                    
            strSql.Append(" [ClickCount] = @ClickCount , ");                                    
            strSql.Append(" [State] = @State , ");                                    
            strSql.Append(" [Status] = @Status , ");                                    
            strSql.Append(" [Creator] = @Creator , ");                                    
            strSql.Append(" [Created] = @Created , ");                                    
            strSql.Append(" [Modifier] = @Modifier , ");                                    
            strSql.Append(" [Modified] = @Modified , ");                                    
            strSql.Append(" [ImagesSPAttr] = @ImagesSPAttr  ");            			
			strSql.Append(" where [Id]=@Id  ");
						
			SqlParameter[] parameters = {
			            new SqlParameter("@Id", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@ProduceNO", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@ShopProduceName", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@PriceWai", SqlDbType.Decimal,9) ,            
                        new SqlParameter("@PriceNei", SqlDbType.Decimal,9) ,            
                        new SqlParameter("@PriceMin", SqlDbType.Decimal,9) ,            
                        new SqlParameter("@NumberMin", SqlDbType.Int,4) ,            
                        new SqlParameter("@SellsNumber", SqlDbType.Int,4) ,            
                        new SqlParameter("@Unit", SqlDbType.NVarChar,10) ,            
                        new SqlParameter("@ShopUsersName", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@Transactions", SqlDbType.Int,4) ,            
                        new SqlParameter("@Address", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@Contact", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@Description", SqlDbType.NVarChar,4000) ,            
                        new SqlParameter("@ShopBrandId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@ShopTypeID", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@StoreBaseID", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@StoreBaseName", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@InsertDateTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@UpdateDateTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@StartDateTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@LimitDays", SqlDbType.Int,4) ,            
                        new SqlParameter("@UserID", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@UserName", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@ImagesPhoto", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@ImagesSP", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@IsHave", SqlDbType.Int,4) ,            
                        new SqlParameter("@ClickCount", SqlDbType.Int,4) ,            
                        new SqlParameter("@State", SqlDbType.Int,4) ,            
                        new SqlParameter("@Status", SqlDbType.Int,4) ,            
                        new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Created", SqlDbType.DateTime) ,            
                        new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Modified", SqlDbType.DateTime) ,            
                        new SqlParameter("@ImagesSPAttr", SqlDbType.NVarChar,1000)             
              
            };
            			            
            parameters[0].Value = model.Id;                        
            parameters[1].Value = model.ProduceNO;                        
            parameters[2].Value = model.ShopProduceName;                        
            parameters[3].Value = model.PriceWai;                        
            parameters[4].Value = model.PriceNei;                        
            parameters[5].Value = model.PriceMin;                        
            parameters[6].Value = model.NumberMin;                        
            parameters[7].Value = model.SellsNumber;                        
            parameters[8].Value = model.Unit;                        
            parameters[9].Value = model.ShopUsersName;                        
            parameters[10].Value = model.Transactions;                        
            parameters[11].Value = model.Address;                        
            parameters[12].Value = model.Contact;                        
            parameters[13].Value = model.Description;                        
            parameters[14].Value = model.ShopBrandId;                        
            parameters[15].Value = model.ShopTypeID;                        
            parameters[16].Value = model.StoreBaseID;                        
            parameters[17].Value = model.StoreBaseName;                        
            parameters[18].Value = model.InsertDateTime;                        
            parameters[19].Value = model.UpdateDateTime;                        
            parameters[20].Value = model.StartDateTime;                        
            parameters[21].Value = model.LimitDays;                        
            parameters[22].Value = model.UserID;                        
            parameters[23].Value = model.UserName;                        
            parameters[24].Value = model.ImagesPhoto;                        
            parameters[25].Value = model.ImagesSP;                        
            parameters[26].Value = model.IsHave;                        
            parameters[27].Value = model.ClickCount;                        
            parameters[28].Value = model.State;                        
            parameters[29].Value = model.Status;                        
            parameters[30].Value = model.Creator;                        
            parameters[31].Value = model.Created;                        
            parameters[32].Value = model.Modifier;                        
            parameters[33].Value = model.Modified;                        
            parameters[34].Value = model.ImagesSPAttr;                        
            int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
		
		
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(long Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ShopProduceCopyGuo ");
			strSql.Append(" where Id=@Id  ");
						SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = Id;


			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
				/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string Idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ShopProduceCopyGuo ");
			strSql.Append(" where Id in ("+Idlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
				
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopProduceCopyGuoItem GetModel(long Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Id, ProduceNO, ShopProduceName, PriceWai, PriceNei, PriceMin, NumberMin, SellsNumber, Unit, ShopUsersName, Transactions, Address, Contact, Description, ShopBrandId, ShopTypeID, StoreBaseID, StoreBaseName, InsertDateTime, UpdateDateTime, StartDateTime, LimitDays, UserID, UserName, ImagesPhoto, ImagesSP, IsHave, ClickCount, State, Status, Creator, Created, Modifier, Modified, ImagesSPAttr  ");			
			strSql.Append("  from ShopProduceCopyGuo ");
			strSql.Append(" where Id=@Id  ");
						SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = Id;

			
			XQ.SP.Model.ShopProduceCopyGuoItem model=new XQ.SP.Model.ShopProduceCopyGuoItem();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=long.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
																																				model.ProduceNO= ds.Tables[0].Rows[0]["ProduceNO"].ToString();
																																model.ShopProduceName= ds.Tables[0].Rows[0]["ShopProduceName"].ToString();
																												if(ds.Tables[0].Rows[0]["PriceWai"].ToString()!="")
				{
					model.PriceWai=decimal.Parse(ds.Tables[0].Rows[0]["PriceWai"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["PriceNei"].ToString()!="")
				{
					model.PriceNei=decimal.Parse(ds.Tables[0].Rows[0]["PriceNei"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["PriceMin"].ToString()!="")
				{
					model.PriceMin=decimal.Parse(ds.Tables[0].Rows[0]["PriceMin"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["NumberMin"].ToString()!="")
				{
					model.NumberMin=int.Parse(ds.Tables[0].Rows[0]["NumberMin"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["SellsNumber"].ToString()!="")
				{
					model.SellsNumber=int.Parse(ds.Tables[0].Rows[0]["SellsNumber"].ToString());
				}
																																				model.Unit= ds.Tables[0].Rows[0]["Unit"].ToString();
																																model.ShopUsersName= ds.Tables[0].Rows[0]["ShopUsersName"].ToString();
																												if(ds.Tables[0].Rows[0]["Transactions"].ToString()!="")
				{
					model.Transactions=int.Parse(ds.Tables[0].Rows[0]["Transactions"].ToString());
				}
																																				model.Address= ds.Tables[0].Rows[0]["Address"].ToString();
																																model.Contact= ds.Tables[0].Rows[0]["Contact"].ToString();
																																model.Description= ds.Tables[0].Rows[0]["Description"].ToString();
																												if(ds.Tables[0].Rows[0]["ShopBrandId"].ToString()!="")
				{
					model.ShopBrandId=long.Parse(ds.Tables[0].Rows[0]["ShopBrandId"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["ShopTypeID"].ToString()!="")
				{
					model.ShopTypeID=long.Parse(ds.Tables[0].Rows[0]["ShopTypeID"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["StoreBaseID"].ToString()!="")
				{
					model.StoreBaseID=long.Parse(ds.Tables[0].Rows[0]["StoreBaseID"].ToString());
				}
																																				model.StoreBaseName= ds.Tables[0].Rows[0]["StoreBaseName"].ToString();
																												if(ds.Tables[0].Rows[0]["InsertDateTime"].ToString()!="")
				{
					model.InsertDateTime=DateTime.Parse(ds.Tables[0].Rows[0]["InsertDateTime"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["UpdateDateTime"].ToString()!="")
				{
					model.UpdateDateTime=DateTime.Parse(ds.Tables[0].Rows[0]["UpdateDateTime"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["StartDateTime"].ToString()!="")
				{
					model.StartDateTime=DateTime.Parse(ds.Tables[0].Rows[0]["StartDateTime"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["LimitDays"].ToString()!="")
				{
					model.LimitDays=int.Parse(ds.Tables[0].Rows[0]["LimitDays"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["UserID"].ToString()!="")
				{
					model.UserID=long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
				}
																																				model.UserName= ds.Tables[0].Rows[0]["UserName"].ToString();
																																model.ImagesPhoto= ds.Tables[0].Rows[0]["ImagesPhoto"].ToString();
																																model.ImagesSP= ds.Tables[0].Rows[0]["ImagesSP"].ToString();
																												if(ds.Tables[0].Rows[0]["IsHave"].ToString()!="")
				{
					model.IsHave=int.Parse(ds.Tables[0].Rows[0]["IsHave"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["ClickCount"].ToString()!="")
				{
					model.ClickCount=int.Parse(ds.Tables[0].Rows[0]["ClickCount"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["State"].ToString()!="")
				{
					model.State=int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Status"].ToString()!="")
				{
					model.Status=int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(ds.Tables[0].Rows[0]["Creator"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(ds.Tables[0].Rows[0]["Created"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(ds.Tables[0].Rows[0]["Modifier"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(ds.Tables[0].Rows[0]["Modified"].ToString());
				}
																																				model.ImagesSPAttr= ds.Tables[0].Rows[0]["ImagesSPAttr"].ToString();
																										
				return model;
			}
			else
			{
				return null;
			}
		}
		
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopProduceCopyGuoItem GetModelWhereStr(string whereStr)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Id, ProduceNO, ShopProduceName, PriceWai, PriceNei, PriceMin, NumberMin, SellsNumber, Unit, ShopUsersName, Transactions, Address, Contact, Description, ShopBrandId, ShopTypeID, StoreBaseID, StoreBaseName, InsertDateTime, UpdateDateTime, StartDateTime, LimitDays, UserID, UserName, ImagesPhoto, ImagesSP, IsHave, ClickCount, State, Status, Creator, Created, Modifier, Modified, ImagesSPAttr  ");			
			strSql.Append("  from ShopProduceCopyGuo ");
            if (whereStr != "")
            {
                strSql.Append(" where "+whereStr);
            }
			
			XQ.SP.Model.ShopProduceCopyGuoItem model=new XQ.SP.Model.ShopProduceCopyGuoItem();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=long.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
																																				model.ProduceNO= ds.Tables[0].Rows[0]["ProduceNO"].ToString();
																																model.ShopProduceName= ds.Tables[0].Rows[0]["ShopProduceName"].ToString();
																												if(ds.Tables[0].Rows[0]["PriceWai"].ToString()!="")
				{
					model.PriceWai=decimal.Parse(ds.Tables[0].Rows[0]["PriceWai"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["PriceNei"].ToString()!="")
				{
					model.PriceNei=decimal.Parse(ds.Tables[0].Rows[0]["PriceNei"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["PriceMin"].ToString()!="")
				{
					model.PriceMin=decimal.Parse(ds.Tables[0].Rows[0]["PriceMin"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["NumberMin"].ToString()!="")
				{
					model.NumberMin=int.Parse(ds.Tables[0].Rows[0]["NumberMin"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["SellsNumber"].ToString()!="")
				{
					model.SellsNumber=int.Parse(ds.Tables[0].Rows[0]["SellsNumber"].ToString());
				}
																																				model.Unit= ds.Tables[0].Rows[0]["Unit"].ToString();
																																model.ShopUsersName= ds.Tables[0].Rows[0]["ShopUsersName"].ToString();
																												if(ds.Tables[0].Rows[0]["Transactions"].ToString()!="")
				{
					model.Transactions=int.Parse(ds.Tables[0].Rows[0]["Transactions"].ToString());
				}
																																				model.Address= ds.Tables[0].Rows[0]["Address"].ToString();
																																model.Contact= ds.Tables[0].Rows[0]["Contact"].ToString();
																																model.Description= ds.Tables[0].Rows[0]["Description"].ToString();
																												if(ds.Tables[0].Rows[0]["ShopBrandId"].ToString()!="")
				{
					model.ShopBrandId=long.Parse(ds.Tables[0].Rows[0]["ShopBrandId"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["ShopTypeID"].ToString()!="")
				{
					model.ShopTypeID=long.Parse(ds.Tables[0].Rows[0]["ShopTypeID"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["StoreBaseID"].ToString()!="")
				{
					model.StoreBaseID=long.Parse(ds.Tables[0].Rows[0]["StoreBaseID"].ToString());
				}
																																				model.StoreBaseName= ds.Tables[0].Rows[0]["StoreBaseName"].ToString();
																												if(ds.Tables[0].Rows[0]["InsertDateTime"].ToString()!="")
				{
					model.InsertDateTime=DateTime.Parse(ds.Tables[0].Rows[0]["InsertDateTime"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["UpdateDateTime"].ToString()!="")
				{
					model.UpdateDateTime=DateTime.Parse(ds.Tables[0].Rows[0]["UpdateDateTime"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["StartDateTime"].ToString()!="")
				{
					model.StartDateTime=DateTime.Parse(ds.Tables[0].Rows[0]["StartDateTime"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["LimitDays"].ToString()!="")
				{
					model.LimitDays=int.Parse(ds.Tables[0].Rows[0]["LimitDays"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["UserID"].ToString()!="")
				{
					model.UserID=long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
				}
																																				model.UserName= ds.Tables[0].Rows[0]["UserName"].ToString();
																																model.ImagesPhoto= ds.Tables[0].Rows[0]["ImagesPhoto"].ToString();
																																model.ImagesSP= ds.Tables[0].Rows[0]["ImagesSP"].ToString();
																												if(ds.Tables[0].Rows[0]["IsHave"].ToString()!="")
				{
					model.IsHave=int.Parse(ds.Tables[0].Rows[0]["IsHave"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["ClickCount"].ToString()!="")
				{
					model.ClickCount=int.Parse(ds.Tables[0].Rows[0]["ClickCount"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["State"].ToString()!="")
				{
					model.State=int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Status"].ToString()!="")
				{
					model.Status=int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(ds.Tables[0].Rows[0]["Creator"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(ds.Tables[0].Rows[0]["Created"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(ds.Tables[0].Rows[0]["Modifier"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(ds.Tables[0].Rows[0]["Modified"].ToString());
				}
																																				model.ImagesSPAttr= ds.Tables[0].Rows[0]["ImagesSPAttr"].ToString();
																										
				return model;
			}
			else
			{
				return null;
			}
		}
		
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select * ");
			strSql.Append(" FROM ShopProduceCopyGuo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}
		
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" * ");
			strSql.Append(" FROM ShopProduceCopyGuo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}
		
	}
}

